//    Copyright (C) Kherty.  All rights reserved.
namespace OpenLS.Spreadsheet.Parsing
{
    class IdentifierCreator : TokenCreator
    {
        public override char[] FirstChars()
        {
            return CharTypeManager.Alpha_();
        }
        int Len;
        public override Token Match(Lexer l)
        {
            Len = 1;
            char previousChar = '\0';
            while (true)
            {
                char c = l.CurrentCharAt(Len);
                if (!CharTypeManager.IsAlphaNumOrDotOrQuestion(c))
                {
                    if (previousChar == ':')
                    {
                        Len--;
                    }
                    return new Identifier(l.Substring(l.Position, Len));
                }
                previousChar = c;
                Len++;
            }
        }
        public override int MatchSize()
        {
            return Len;
        }
    }
}